package com.example.ObserverPattern_EventBus.observer;

import com.example.ObserverPattern_EventBus.service.NotificationService;
import com.google.common.eventbus.Subscribe;
import org.springframework.stereotype.Component;

import javax.annotation.Resource;

/**
 * <pre>
 * 功能描述：
 * </pre>
 *
 * @author: 李明杰
 * @date: 2022/12/12 21:06
 */
@Component
public class RegNotificationObserver {
    @Resource
    private NotificationService notificationService;

    @Subscribe//如果有匹配的通知类型会自动执行
    public void handleRegSuccess(Long userId) {
        notificationService.sendInboxMessage(userId, "message is sending");
    }
}